package com.ruoyi.web.controller.shortVedio;

import com.ruoyi.common.enums.VideoParseResponse;
import com.ruoyi.system.service.KuaishouService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 快手短视频解析控制器
 * @Author: JH-Ahua
 * @CreateTime: 2025/1/15
 */
@Api(tags = "短视频解析")
@RestController
@RequestMapping("/parse/kuaishou")
@CrossOrigin(origins = "*")
public class KuaishouController {
    
    @Autowired
    private KuaishouService kuaishouService;
    
    @ApiOperation(value = "快手短视频去水印解析", notes = "解析快手分享链接，获取视频信息")
    @ApiImplicitParam(name = "url", value = "快手分享链接", required = true, dataType = "string", paramType = "query")
    @GetMapping("/parse")
    public VideoParseResponse parseKuaishouVideo(@RequestParam("url") String url) {
        return kuaishouService.parseKuaishouVideo(url);
    }
    
    @ApiOperation(value = "快手短视频去水印解析(POST)", notes = "解析快手分享链接，获取视频信息")
    @PostMapping("/parse")
    public VideoParseResponse parseKuaishouVideoPost(@RequestParam("url") String url) {
        return kuaishouService.parseKuaishouVideo(url);
    }
}
